﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Linq;
using PMSGSC.DAL;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;

namespace PMSGSC.App
{
    public partial class rpPart : DevExpress.XtraReports.UI.XtraReport
    {
        public rpPart(List<PartsInEquipment> dataSource)
        {
            InitializeComponent();
            bindingSource1.DataSource = dataSource;
            xrLabel33.Text = DateTime.Now.Date.ToString("MM/dd/yyyy");
            OpenDocument();
        }
        private void OpenDocument()
        {
            try
            {
                string Address = Application.StartupPath + "\\Attachment\\";
                Directory.CreateDirectory(Address);
                if (null != bindingSource1.DataSource)
                {
                    PartsInEquipment part = bindingSource1.Cast<PartsInEquipment>().ToList()[0];
                    string fileName = part.Equipment.Ship.NameShip + part.Equipment.Ship.Extension;
                    Address += fileName;
                    xrPictureBox1.ImageUrl = Address;
                }
            }
            catch { }
        }
       

    }
}
